package com.base.system.managedBean;

import java.io.Serializable;
import java.util.Map;

import javax.faces.context.FacesContext;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.operamasks.faces.annotation.BeforeRender;
import org.operamasks.faces.annotation.Inject;
import org.operamasks.faces.annotation.ManagedBean;
import org.operamasks.faces.annotation.ManagedBeanScope;

import com.base.security.SecurityConst;
import com.base.security.entity.SecurityRole;
import com.base.system.managedBean.baseBean.BaseSecurityRoleBean;

/**
 * 
 * This managed bean is generated automatically
 */
@ManagedBean(name = "system_showSecurityRoleBean", scope = ManagedBeanScope.REQUEST)
public class ShowSecurityRoleBean extends BaseSecurityRoleBean implements
		Serializable {
	private final static Log logger = LogFactory
			.getLog(ShowSecurityRoleBean.class);
	@Inject
	private FacesContext context;

	@BeforeRender
	public void beforeRender(boolean isPostback) {
		// System.out.println("show 中的 postBack:" + isPostback);
		// 只有第一加载的时候才从session进行取值，后来提交后就不取值了
		if (!isPostback) {
			Map<String, Object> session = context.getExternalContext()
					.getSessionMap();
			securityRole = (SecurityRole) session
					.get(SecurityConst.SECURITYROLE_SELECT_ROW_DATA);
			this.getSecurityRoleProperty();
		}
	}
}
